{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "d1248098-4fe8-4d90-b134-663e74411fb7",
   "metadata": {},
   "source": [
    "# 一、重塑和转置"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0237afc7-c3f3-4498-95af-8ad3d5a5cc58",
   "metadata": {},
   "source": [
    "## （1）重塑"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "f57ef96e-4169-4b29-85b0-5ceef7c05377",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "078bec3c-ad32-470d-a612-f11a627ac4d6",
   "metadata": {},
   "outputs": [],
   "source": [
    "arr = np.random.randint(10, 50, size=(10, ))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "7f894f80-29f3-4536-a23e-ac53ca4c39d2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([39, 16, 29, 34, 24, 11, 18, 32, 45, 41], dtype=int32)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4ec7ecaa-180f-4c10-b222-c9158cb4bfef",
   "metadata": {},
   "source": [
    "### ① 一维数组重塑 reshape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "97248fbc-c473-4412-8b19-34a0e5a04275",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(10,)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "69cfd8d1-9dc7-4ef0-b9ec-d464f789126c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[39, 16, 29, 34, 24],\n",
       "       [11, 18, 32, 45, 41]], dtype=int32)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 同时指定行和列\n",
    "arr.reshape(2, 5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "2cf43df6-2f50-4b3d-8885-2f837e70d859",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[39, 16, 29, 34, 24, 11, 18, 32, 45, 41]], dtype=int32)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 只指定一个，另一个numpy自己计算\n",
    "arr.reshape(1, -1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "a6fc19f8-fd75-4204-9130-c0b9f61d692f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[39, 16],\n",
       "       [29, 34],\n",
       "       [24, 11],\n",
       "       [18, 32],\n",
       "       [45, 41]], dtype=int32)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.reshape(5, -1)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "27f95caa-e09f-4aa1-9679-47493c810141",
   "metadata": {},
   "source": [
    "### ② 多维数组重塑 reshape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "2cb26036-3bfe-4740-8921-9e02c1b6c482",
   "metadata": {},
   "outputs": [],
   "source": [
    "arr2 = np.random.normal(size=(3, 4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "6d017fa7-c885-4ff4-b4c4-4870de1f4e58",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1.06195369, -1.65313137, -0.6583667 , -0.03197886],\n",
       "       [ 0.293845  , -0.31270015, -0.52342463,  1.57731511],\n",
       "       [ 0.48259367, -0.27707723, -2.09382327,  0.60144735]])"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "4796980e-ac74-4e54-9f8f-5ef98b322ab0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1.06195369, -1.65313137, -0.6583667 , -0.03197886,  0.293845  ,\n",
       "        -0.31270015],\n",
       "       [-0.52342463,  1.57731511,  0.48259367, -0.27707723, -2.09382327,\n",
       "         0.60144735]])"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr2.reshape(2, -1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "082f600d-e70c-4e0c-aa69-c51744619f55",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1.06195369, -1.65313137],\n",
       "       [-0.6583667 , -0.03197886],\n",
       "       [ 0.293845  , -0.31270015],\n",
       "       [-0.52342463,  1.57731511],\n",
       "       [ 0.48259367, -0.27707723],\n",
       "       [-2.09382327,  0.60144735]])"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr2.reshape(6, 2)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "152b72bf-7cba-437e-b3dc-0b6cc4b529af",
   "metadata": {},
   "source": [
    "# 二、转置"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e9816843-38e3-4a65-8e2f-d14f1587c1c8",
   "metadata": {},
   "source": [
    "## （1）T"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "156512a8-224d-43ef-b280-aec6f4fb454e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1.06195369, -1.65313137, -0.6583667 , -0.03197886],\n",
       "       [ 0.293845  , -0.31270015, -0.52342463,  1.57731511],\n",
       "       [ 0.48259367, -0.27707723, -2.09382327,  0.60144735]])"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "348af002-3275-4b7a-8398-7f2913faf51b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(3, 4)"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr2.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "a0091717-0bb0-4a8f-a891-659269fac206",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1.06195369,  0.293845  ,  0.48259367],\n",
       "       [-1.65313137, -0.31270015, -0.27707723],\n",
       "       [-0.6583667 , -0.52342463, -2.09382327],\n",
       "       [-0.03197886,  1.57731511,  0.60144735]])"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr2.T"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "1d87ca3f-cc54-4fec-9e27-243fbe3b1ea3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(4, 3)"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr2.T.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "92816763-4b7d-4c2a-b871-9e132cc7b57a",
   "metadata": {},
   "source": [
    "## （2）transpose"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "4be8eb21-6088-4c37-82b3-80503a17de49",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(3, 4)"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr2.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "84706c51-6772-49f1-82db-8603163d4d80",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1.06195369,  0.293845  ,  0.48259367],\n",
       "       [-1.65313137, -0.31270015, -0.27707723],\n",
       "       [-0.6583667 , -0.52342463, -2.09382327],\n",
       "       [-0.03197886,  1.57731511,  0.60144735]])"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.transpose(arr2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "733c78f7-49fe-4cb1-8c43-a3c1aad5c9b9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(4, 3)"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.transpose(arr2).shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "443375ce-190d-4473-868c-5c62cfd66611",
   "metadata": {},
   "outputs": [],
   "source": [
    "arr4 = np.arange(24).reshape(4, -1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "fd074e90-ef60-49ed-98a8-9d03c9cf6d42",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3,  4,  5],\n",
       "       [ 6,  7,  8,  9, 10, 11],\n",
       "       [12, 13, 14, 15, 16, 17],\n",
       "       [18, 19, 20, 21, 22, 23]])"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "36104f81-a3f9-4d53-b25e-4616b5c8ab65",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  6, 12, 18],\n",
       "       [ 1,  7, 13, 19],\n",
       "       [ 2,  8, 14, 20],\n",
       "       [ 3,  9, 15, 21],\n",
       "       [ 4, 10, 16, 22],\n",
       "       [ 5, 11, 17, 23]])"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.transpose(arr4)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "56ac452e-9ba5-4700-96c3-2bdc56e78aee",
   "metadata": {},
   "source": [
    "# 二、级联"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d35dbbb7-0a4b-4003-849e-fd5db072e000",
   "metadata": {},
   "source": [
    "## （1）concatenate"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "5e5e68c1-beb3-4a57-8e68-3e8482af9244",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3,  4,  5],\n",
       "       [ 6,  7,  8,  9, 10, 11],\n",
       "       [12, 13, 14, 15, 16, 17],\n",
       "       [18, 19, 20, 21, 22, 23]])"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "4adbeb24-769d-4142-a48f-6682f24d4716",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(4, 6)"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr4.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "285320e9-a4d8-45f3-b2f0-7cfe9942fd74",
   "metadata": {},
   "outputs": [],
   "source": [
    "arr5 = np.random.randint(1, 10, size=(4, 3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "2aed7e18-7770-4d06-9e73-b33c3ada87e3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 5, 8],\n",
       "       [7, 2, 8],\n",
       "       [4, 9, 6],\n",
       "       [3, 8, 8]], dtype=int32)"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "4e2bd1d6-1d4b-4b86-98f9-96fe239be320",
   "metadata": {},
   "outputs": [
    {
     "ename": "ValueError",
     "evalue": "all the input array dimensions except for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 6 and the array at index 1 has size 3",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mValueError\u001b[0m                                Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[32], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43mnp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mconcatenate\u001b[49m\u001b[43m(\u001b[49m\u001b[43m(\u001b[49m\u001b[43marr4\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43marr5\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m  \u001b[38;5;66;03m# 默认是axis=0\u001b[39;00m\n",
      "\u001b[1;31mValueError\u001b[0m: all the input array dimensions except for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 6 and the array at index 1 has size 3"
     ]
    }
   ],
   "source": [
    "np.concatenate((arr4, arr5))  # 默认是axis=0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "7afb3792-f7ae-42f8-9e53-3769eb72b34e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3,  4,  5,  1,  5,  8],\n",
       "       [ 6,  7,  8,  9, 10, 11,  7,  2,  8],\n",
       "       [12, 13, 14, 15, 16, 17,  4,  9,  6],\n",
       "       [18, 19, 20, 21, 22, 23,  3,  8,  8]])"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.concatenate((arr4, arr5), axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "db4ce446-dc33-4321-acaa-96590b62f549",
   "metadata": {},
   "outputs": [],
   "source": [
    "arr6 = arr4.reshape(-1, 3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "a60d547d-f894-48c1-8844-7b93c6b985d9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2],\n",
       "       [ 3,  4,  5],\n",
       "       [ 6,  7,  8],\n",
       "       [ 9, 10, 11],\n",
       "       [12, 13, 14],\n",
       "       [15, 16, 17],\n",
       "       [18, 19, 20],\n",
       "       [21, 22, 23]])"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "28482a02-3fba-4a13-89a0-07ebb1dd520e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1,  5,  8],\n",
       "       [ 7,  2,  8],\n",
       "       [ 4,  9,  6],\n",
       "       [ 3,  8,  8],\n",
       "       [ 0,  1,  2],\n",
       "       [ 3,  4,  5],\n",
       "       [ 6,  7,  8],\n",
       "       [ 9, 10, 11],\n",
       "       [12, 13, 14],\n",
       "       [15, 16, 17],\n",
       "       [18, 19, 20],\n",
       "       [21, 22, 23]])"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.concatenate((arr5, arr6))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "ada09515-6460-4335-a06b-2373532b62f7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1,  5,  8],\n",
       "       [ 7,  2,  8],\n",
       "       [ 4,  9,  6],\n",
       "       [ 3,  8,  8],\n",
       "       [ 0,  1,  2],\n",
       "       [ 3,  4,  5],\n",
       "       [ 6,  7,  8],\n",
       "       [ 9, 10, 11],\n",
       "       [12, 13, 14],\n",
       "       [15, 16, 17],\n",
       "       [18, 19, 20],\n",
       "       [21, 22, 23]])"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.concatenate((arr5, arr6), axis=0)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ba2cc9db-c0fd-418d-8cca-b4472257a564",
   "metadata": {},
   "source": [
    "## （2）hstack"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "fe254419-da57-4882-9ba8-2a4893332526",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1.06195369, -1.65313137, -0.6583667 , -0.03197886],\n",
       "       [ 0.293845  , -0.31270015, -0.52342463,  1.57731511],\n",
       "       [ 0.48259367, -0.27707723, -2.09382327,  0.60144735]])"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# horizontal\n",
    "arr2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "c9e96233-f947-4afb-953e-8a52ec53fd6a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(3, 4)"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr2.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "2eb3252a-c385-4290-9644-40b0b4987da4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(4, 6)"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr4.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "dc7fac7f-0279-4e06-acc9-941a1074cdf9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(4, 3)"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr3 = arr2.T\n",
    "arr3.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "c7579b45-666e-48f6-b344-d23f9f050fdb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1.06195369,  0.293845  ,  0.48259367,  0.        ,  1.        ,\n",
       "         2.        ,  3.        ,  4.        ,  5.        ],\n",
       "       [-1.65313137, -0.31270015, -0.27707723,  6.        ,  7.        ,\n",
       "         8.        ,  9.        , 10.        , 11.        ],\n",
       "       [-0.6583667 , -0.52342463, -2.09382327, 12.        , 13.        ,\n",
       "        14.        , 15.        , 16.        , 17.        ],\n",
       "       [-0.03197886,  1.57731511,  0.60144735, 18.        , 19.        ,\n",
       "        20.        , 21.        , 22.        , 23.        ]])"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.hstack((arr3, arr4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "9d5cb84d-97be-43e7-8fc8-8d34b16ab7c9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0.        ,  1.        ,  2.        ,  3.        ,  4.        ,\n",
       "         5.        ,  1.06195369,  0.293845  ,  0.48259367],\n",
       "       [ 6.        ,  7.        ,  8.        ,  9.        , 10.        ,\n",
       "        11.        , -1.65313137, -0.31270015, -0.27707723],\n",
       "       [12.        , 13.        , 14.        , 15.        , 16.        ,\n",
       "        17.        , -0.6583667 , -0.52342463, -2.09382327],\n",
       "       [18.        , 19.        , 20.        , 21.        , 22.        ,\n",
       "        23.        , -0.03197886,  1.57731511,  0.60144735]])"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.hstack((arr4, arr3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "280488b6-c86b-46b2-8244-5182f2b079e8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1.06195369, -1.65313137, -0.6583667 , -0.03197886],\n",
       "       [ 0.293845  , -0.31270015, -0.52342463,  1.57731511],\n",
       "       [ 0.48259367, -0.27707723, -2.09382327,  0.60144735]])"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# vertical\n",
    "arr2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "16be07b0-7e9a-43bd-a6f2-520f057a276c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1.06195369,  0.293845  ,  0.48259367],\n",
       "       [-1.65313137, -0.31270015, -0.27707723],\n",
       "       [-0.6583667 , -0.52342463, -2.09382327],\n",
       "       [-0.03197886,  1.57731511,  0.60144735]])"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "549fa548-d369-4e50-a9a4-0b64200d791c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(3, 4)"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "(4, 3)"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "display(arr2.shape, arr3.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "6494c45f-fce1-4edf-b61e-3bed68063b15",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1.06195369,  0.293845  ,  0.48259367],\n",
       "       [-1.65313137, -0.31270015, -0.27707723],\n",
       "       [-0.6583667 , -0.52342463, -2.09382327],\n",
       "       [-0.03197886,  1.57731511,  0.60144735],\n",
       "       [ 1.06195369,  0.293845  ,  0.48259367],\n",
       "       [-1.65313137, -0.31270015, -0.27707723],\n",
       "       [-0.6583667 , -0.52342463, -2.09382327],\n",
       "       [-0.03197886,  1.57731511,  0.60144735]])"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.vstack((arr2.T, arr3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2924e5c5-ffa0-4c94-ad9b-cc99f794f92e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
